Skip to main content

WorkflowInstance

The WorkflowInstance class manages the execution and state of a workflow, providing methods to initialize, start, continue, and manage workflow processes.

Properties

NameDescription
ReasonsStores a dictionary of reasons associated with the workflow instance, often used for capturing feedback or notes at different workflow stages.
AgentModeGets a value indicating whether the workflow instance is in agent mode.
ParentProcessIdGets or sets the parent process identifier for the workflow instance, if applicable.
ProjectNameGets the name of the project associated with the workflow instance.
DocumentParametersGets the document parameters for the workflow instance.
VersionGets or sets the version of the workflow instance. Default value is "latest".
FlowSecretKeyGets the secret key for the workflow flow.
ProcessRequestObjectNameGets or sets the name of the process request object for the workflow instance.
VariablesGets the variables associated with the workflow instance.
RequestIdGets the request identifier for the workflow instance, if applicable.
StartingEventGets or sets the starting event for the workflow instance.
DocumentOptionsGets the list of document options for the workflow instance.
DocumentsGets the documents associated with the workflow instance.
DeploymentUrlGets the deployment URL for the workflow instance.
EventsGets the events associated with the workflow instance.
ProcessIdGets the process identifier for the workflow instance.
FlowNameGets the name of the flow associated with the workflow instance.

Constructors

NameDescription
WorkflowInstance(projectName, flowName, processId, agentMode, api, documentOptions)Initializes a new instance of the WorkflowInstance class with specified project details, workflow settings, API connection, and document options.
WorkflowInstance(projectName, flowName, processId, agentMode, api)Initializes a new instance of the WorkflowInstance class with specified project and flow names, process ID, agent mode, and API instance.
WorkflowInstance(options)Initializes a new instance of the WorkflowInstance class with specified initial options for configuration.

Methods

NameDescription
Initialize(telemetryCollectorHolder)Initializes the workflow instance by loading and setting up necessary parameters. This method performs actions like retrieving the version by process ID if in agent mode and loading initial and start parameters.
Continue(telemetryCollectorHolder)Continues the workflow instance by proceeding along the path defined by the StartingEvent value, following the configured workflow process.
SaveAndContinue(telemetryCollectorHolder)Saves the current state of the workflow instance and then continues along the path defined by the StartingEvent value, ensuring workflow progress is preserved and resumed.
Start(telemetryCollectorHolder)Initiates the workflow instance by starting the configured workflow process. This method executes the initial steps required to activate the workflow.
SetStarterUserByUserName(userName, telemetryCollectorHolder)Sets the starter user of the workflow instance by the specified username, retrieving user information from HR services to validate and assign the starter user.
SetStarterUserByUserId(userId, telemetryCollectorHolder)Sets the starter user of the workflow instance by the specified user ID, retrieving user information from HR services to validate and assign the starter user.
GetFlowHistory(telemetryCollectorHolder)Retrieves the flow history of the workflow instance, providing detailed historical information for the workflow process, including actions, statuses, and associated data.
UpdateFlowStatus(requestId, statusId, telemetryCollectorHolder)Updates the status of the workflow instance based on the specified request ID and status ID, modifying the current state within the workflow.
DeleteSubProcesses(telemetryCollectorHolder)Deletes all sub-processes associated with the current workflow instance, removing any nested workflows that are linked to it.